#!/usr/bin/awk -f
BEGIN {}
{
  p=$2;
  FS="[ ]";
  o=$3;
  for (i=4;i<=NF-1;i++)
    o=o" "$i;

  # build id lookup table for predicates
  if (!(p in p_list))
    p_list[p] = p_count++;

  # build id lookup table for objects
  if (!(o in o_list))
    o_list[o] = o_count++;

  po_list[p_list[p] ":" o_list[o]]++;
}
END {
  count=0;

  # process all stored subjects/objects
  for (i in po_list) {
    print i, po_list[i];
  }
}
